﻿using System;
using fastCSharp;
using System.Reflection;

namespace diantou.web.ajax.topics
{
    /// <summary>
    /// 相关话题操作
    /// </summary>
    class examHandle<callType, topicType> : userHandle<callType>
        where callType : examHandle<callType, topicType> 
        where topicType : diantou.dataModel.topics
    {
        /// <summary>
        /// 修改相关话题
        /// </summary>
        /// <param name="linkId"></param>
        /// <param name="topicIds"></param>
        /// <param name="onReturn"></param>
        [fastCSharp.code.cSharp.ajax]
        public virtual void Rework(int linkId, int[] topicIds, Action<fastCSharp.net.returnValue<bool>> onReturn)
        {
            rework(linkId, topicIds, currentUser.Id, onReturn);
        }

        /// <summary>
        /// 修改相关话题
        /// </summary>
        private static readonly Action<int, int[], int, Action<fastCSharp.net.returnValue<bool>>> rework;
        static examHandle()
        {
            Type type = typeof(topicType);
            type = type.Assembly.GetType("diantou.examDataAccess.tcpCall+" + type.Name);
            rework = (Action<int, int[], int, Action<fastCSharp.net.returnValue<bool>>>)Delegate.CreateDelegate(typeof(Action<int, int[], int, Action<fastCSharp.net.returnValue<bool>>>), type.GetMethod("rework", BindingFlags.Static | BindingFlags.Public, null, new Type[] { typeof(int), typeof(int[]), typeof(int), typeof(Action<fastCSharp.net.returnValue<bool>>) }, null));
        }
    }
}
